__author__ = 'Administrator'
# -*- coding: utf-8 -*-
import wx
import time

import sys


class Frame(wx.Frame):
    def __init__(self, parent, id, title):
        print "now:" + time.strftime('%Y-%m-%d %H:%M:%d')
        size = 500, 500
        wx.Frame.__init__(self, parent, id, title)


class App(wx.App):
    def __init__(self, redirect=True, filename=None):
        print "APp.__init__"
        wx.App.__init__(self, redirect, filename)

    def OnInit(self):
        print "OnInit"
        date = 'now:' + str(time.strftime('%Y-%m-%d %H:%M:%d'))
        self.frame = Frame(parent=None, id=-1, title=date)
        self.frame.Show()
        self.SetTopWindow(self.frame)
        print sys.stderr, "this is a errr message"
        return True

    def OnExit(self):
        print ("on exit")


if __name__ == "__main__":
    app = App(redirect=True)#redirect 决定是否重定向
    print "before MainLoop" #进入主事件循环前
    app.MainLoop()
    print "after MainLoop"


